#ifndef JAE_GLWIDGET_H_
#define JAE_GLWIDGET_H_

#include "sceneManager.h"

/****************************************************//**
 * Project-Namespace
 ********************************************************/
namespace jae
{

/****************************************************//**
 * extended QGLWidget class.
 ********************************************************/
class GLWidget : public QGLWidget 
{
public:
    GLWidget(SceneManager *aSceneManager, QGLWidget* aParent = NULL);
    ~GLWidget();

    void showFPS();
    void hideFPS();
    
    void setSceneManager(SceneManager *aSceneManager);
    Camera* getCamera();
    void setCamera(Camera* aCamera);
    bool isSplashScreen();
    void setSplashScreen(bool aSplashScreen);
    
protected:
    virtual void resizeEvent(QResizeEvent * aEvent);
    virtual void paintGLEvent();
    
    void paintGL();

    SceneManager* _pSceneManager;

    Camera *_pCamera; //TODO wieder private machen

private:    
    void renderFPS();
    void renderCube();
    void renderSplashScreen();
    void renderNoCameraWarning();
    void setGLProjectionMatrix(Node *aNode);
    
    bool _showFpsCounter; //set by an other Thread
    QTime _time;
    QTimer *_pRepaintTimer;
    QFont _renderFont;
    int _frameCount;
    int _frameTime;
    int _fps;
    bool _splashScreen;
    int _splashScreenCounter; 

    GLenum _maxLights;

};

} //namespace

#endif /*JAE_GLWIDGET_H_*/
